<template>
  <div class="vip-card">
    <div >
      <div class="vip-header">
        <svg-icon v-if="!onlyVip" name="role" class="vip-icon" />
        <span class="vip-title">{{title}}</span>
      </div>
      <div class="vip-stats" v-if="!onlyVip">
        <div class="stat-item" v-for="stat in vipStats" :key="stat.label">
          <span class="stat-num">{{ stat.num }}</span>
          <span class="stat-label">{{ stat.label }}</span>
        </div>
      </div>
    </div>
    <div class="vip-features">
      <div v-for="feature in vipFeatures" :key="feature.name" class="feature-item">
        <svg-icon :name="feature.icon" class="feature-icon" />
        <span>{{ feature.name }}</span>
      </div>
    </div>
    <button class="login-btn" @click="emit('fun')">{{btnName}}</button>
  </div>
</template>

<script setup lang="ts">
import SvgIcon from '@/components/SvgIcon/index.vue'

const emit = defineEmits<{
  fun:[]
}>()

defineProps<{
  onlyVip: boolean;
  title: string,
  btnName: string
}>()
// VIP特权数据
const vipStats = [
  { num: 0, label: '文档' },
  { num: 0, label: '粉丝' },
  { num: 0, label: '知币' }
]
const vipFeatures = [
  { name: '多端同步记录', icon: 'sync' },
  { name: '高速下载文档', icon: 'download' },
  { name: '免费文档工具', icon: 'Tools' },
  { name: '分享文档赚钱', icon: 'share' },
  { name: '每日登录抽奖', icon: 'gift' },
  { name: '优质衍生服务', icon: 'fuwu' }
]

</script>

<style scoped>
.vip-card {
  background: #fff;
  border-radius: 4px;
  padding: 10px;
}
.vip-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.vip-icon {
  width: 30px;
  height: 30px;
  color: #ffd700;
}
.vip-title {
  font-size: 16px;
  color: #75532e;
  font-weight: bold;
}
.vip-stats {
  display: flex;
  justify-content: space-around;
  margin: 0 0 10px 0;
}
.stat-item {
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 20px;
  color: #333;
  font-weight: bold;
}
.stat-label {
  font-size: 12px;
  color: #999;
}
.vip-features {
  background: #fff3d5;
  border-radius: 4px;
  padding: 15px 5px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  justify-items: center;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 14px;
  color: #666;
}
.feature-icon {
  width: 20px;
  height: 20px;
  color: #ccaa6c;
}
.login-btn {
  width: 100%;
  padding: 10px;
  background: #eec072;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-top: -10px;
}
.login-btn:hover {
  background: #d4a95c;
}
</style>
